﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace StreetsOfRageStyleGame
{
    public class SpriteSheet
    {
        private string[] nameList;

        public Texture2D Sheet { get; set; }
        public Dictionary<string, Rectangle> Map { get; set; }

        public Rectangle this[int index]
        {
            get
            {
                // if nameList has not been set up do it now.
                if (nameList == null) nameList = Map.Keys.ToArray();

                return Map[nameList[index]];
            }
            set
            {
                Map[nameList[index]] = value;
            }
        }

        public Rectangle this[String key]
        {
            get
            {
                return Map[key];
            }
            set
            {
                Map[key] = value;
            }
        }

        public int Count { get { return Map.Count; } private set { } }

        public SpriteSheet() { }
    }
}

